{% extends "../master.html" %}

{% block header %}
    {% include "../header.html" %}
{% endblock %}

{% block page %}
    {% if admin %}
    <h3>{{ settings.picture }}:</h3>
    <form class="form" action="/picture/edit_image" method="post">
    <div class="button">
        <img src="/img?url={{ picture.url }}&amp;size=320&amp;nb_of_pictures={{ nb_of_pictures }}"
        alt="{{ picture.url }}" />
        <p>{{ picture.url }}</p>
        <input name="select" value="[Select]" type="submit" />
        <input name="picture_key" value="{{ picture.key }}" type="hidden" />
        <input name="nb_of_pictures" value="{{ nb_of_pictures }}" type="hidden" />
        <input name="size_key" value="{{ size.key }}" type="hidden" />
        <input name="language_key" value="{{ language.key }}" type="hidden" />
    </div>
    </form>
    <h3>{{ settings.author }}:</h3>
    <form class="form" action="/picture/author" method="post">
    <div class="button">
        <b>{{ picture.author.last_name }} {{ picture.author.first_name }}</b> ..
        <select name="select_author_key">
            {% for a in authors %}
                {% ifequal a.key picture.author.key %}
                    <option selected value="{{ a.key }}">{{ a.last_name }} {{ a.first_name }}</option>
                {% else %}
                    <option value="{{ a.key }}">{{ a.last_name }} {{ a.first_name }}</option>
                {% endifequal %}
            {% endfor %}
        </select> |
        <input name="select" value="Select" type="submit" />
        <input name="picture_key" value="{{ picture.key }}" type="hidden" />
        <input name="nb_of_pictures" value="{{ nb_of_pictures }}" type="hidden" />
        <input name="size_key" value="{{ size.key }}" type="hidden" />
        <input name="language_key" value="{{ language.key }}" type="hidden" />
    </div>
    </form>
    <h3>{{ settings.collection }}:</h3>
    <form class="form" action="/picture/collection" method="post">
    <div class="button">
        <b>{{ picture.collection.title }}</b> ..
        <select name="select_collection_key">
            {% for c in collections %}
                {% ifequal c.key picture.collection.key %}
                    <option selected value="{{ c.key }}">{{ c.title }}</option>
                {% else %}
                    <option value="{{ c.key }}">{{ c.title }}</option>
                {% endifequal %}
            {% endfor %}
        </select> |
        <input name="select" value="Select" type="submit" />
        <input name="picture_key" value="{{ picture.key }}" type="hidden" />
        <input name="nb_of_pictures" value="{{ nb_of_pictures }}" type="hidden" />
        <input name="size_key" value="{{ size.key }}" type="hidden" />
        <input name="language_key" value="{{ language.key }}" type="hidden" />
    </div>
    </form>
    <h3>{{ settings.exposition }}:</h3>
    <form class="form" action="/picture/exposition" method="post">
    <div class="button">
        <b>{{ picture.exposition.title }}</b> ..
        <select name="select_exposition_key">
            {% for c in expositions %}
                {% ifequal c.key picture.exposition.key %}
                    <option selected value="{{ c.key }}">{{ c.title }}</option>
                {% else %}
                    <option value="{{ c.key }}">{{ c.title }}</option>
                {% endifequal %}
            {% endfor %}
        </select> |
        <input name="select" value="Select" type="submit" />
        <input name="picture_key" value="{{ picture.key }}" type="hidden" />
        <input name="nb_of_pictures" value="{{ nb_of_pictures }}" type="hidden" />
        <input name="size_key" value="{{ size.key }}" type="hidden" />
        <input name="language_key" value="{{ language.key }}" type="hidden" />
    </div>
    </form>
    <form class="form" action="/picture/save" method="post">
    <div class="button">
        <h3>Title:</h3>
        <input name="title" value="{{ picture.title }}" type="text" />
        <h3>Info:</h3>
        <textarea name="info" rows="24" cols="80" wrap="off">{{ picture.info }}</textarea>
        <p>
            <input name="cancel" value="Cancel" type="submit" /> ||
            <input name="save" value="Save" type="submit" /> |
            <input name="new" value="New" type="submit" /> ||
            <input name="delete" value="Delete" type="submit" />
        </p>
        <input name="picture_key" value="{{ picture.key }}" type="hidden" />
        <input name="nb_of_pictures" value="{{ nb_of_pictures }}" type="hidden" />
        <input name="size_key" value="{{ size.key }}" type="hidden" />
        <input name="language_key" value="{{ language.key }}" type="hidden" />
    </div>
    </form>
    {% endif %}
{% endblock %}

{% block footer %}
    {% include "../footer.html" %}
{% endblock %}
